package com.changpay.zywy.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.changpay.zywy.R
import com.changpay.zywy.bean.CardChangeDetailBean

/**
 * Created by chenxz on 2018/4/22.
 */
class ChangeCardInfoAdapter(private val context: Context?, datas: MutableList<CardChangeDetailBean.DataBean>) :
    BaseQuickAdapter<CardChangeDetailBean.DataBean, BaseViewHolder>(R.layout.item_apply_detail, datas) {

    override fun convert(helper: BaseViewHolder?, item: CardChangeDetailBean.DataBean?) {
        item ?: return
        helper ?: return
        helper.setText(R.id.tv_title, "结算卡修改")
            .setText(R.id.tv_time, item.created_time)
            .setText(R.id.tv_content, item.deposit_bank + " " + item.card_id)
            .setText(R.id.tv_member_name, item.phone_num)
            .setText(R.id.tv_member_id, item.merchant_id.toString())

        when (item.balance_examine_type) {
            "0" -> {
                helper.setText(R.id.tv_type, "待审核")
                helper.setBackgroundRes(R.id.tv_type, R.mipmap.icon_commit_wait)
            }
            "1" -> {
                helper.setText(R.id.tv_type, "审核通过")
                helper.setBackgroundRes(R.id.tv_type, R.mipmap.icon_commit_all)
            }
            "2" -> {
                helper.setText(R.id.tv_type, "审核失败")
                helper.setBackgroundRes(R.id.tv_type, R.mipmap.icon_commit_ref)
            }
        }
    }
}

